// 当前时间
export const formatTime = (data: Date | string, flag: boolean) => {
  const date = new Date(data)
  const y = date.getFullYear()
  let m: number | string = date.getMonth() + 1
  m = m < 10 ? ('0' + m) : m
  let d: number | string = date.getDate()
  d = d < 10 ? ('0' + d) : d
  let h: number | string = date.getHours()
  h = h < 10 ? ('0' + h) : h
  let minute: number | string = date.getMinutes()
  minute = minute < 10 ? ('0' + minute) : minute
  let second: number | string = date.getSeconds()
  second = second < 10 ? ('0' + second) : second
  if (flag) {
    return y + '-' + m + '-' + d
  }
  return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second
}


export const formatTime1 = (data: number) => {
  let hours = parseInt((data % (60 * 60 * 24) / (60 * 60)).toString())
  let minutes = parseInt((data % (60 * 60) / 60).toString())
  let seconds = data % 60
  return (hours < 10 ? ("0" + hours) : hours) + ":" +
    (minutes < 10 ? ("0" + minutes) : minutes) + ":" +
    (seconds < 10 ? ("0" + seconds) : seconds)
}                                               